package cn.com.kh;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class UcisXML {

	private static final Log log = LogFactory.getLog(UcisXML.class);

	public static String getV(String xml, String Key) {
		Document doc = null;
		String KeyValue = null;
		log.debug("ReadStringXML Key Begin Key : " + Key);
		try {

			// 将字符串转为XML
			doc = DocumentHelper.parseText(xml);
			
			// 获取根节点
			Element rootElt = doc.getRootElement();

			// 获取根节点下的子节点head
			KeyValue = rootElt.getStringValue();

		} catch (Exception e) {
			log.error("Exception : " + e.getMessage());

		}
		log.error("ReadStringXML Key End KeyValue : " + KeyValue);
		return KeyValue;
	}
}
